package com.siwei.mes.sync.tc.service;

import com.alibaba.fastjson.JSON;
import com.siwei.mes.entity.sync.tc.SupplyTask;
import com.siwei.mes.mapper.syncTc.SupplyTaskMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 供货任务
 *
 * @Description: 供货任务
 * @Version: 1.0
 * @author: chenmaolin
 * @date: 2024/1/13 11:23
 */
@Service
public class SyncTcSupplyTaskService {
    private static final Logger log = LoggerFactory.getLogger("tc");
    @Resource
    private SupplyTaskMapper supplyTaskMapper;

    public void operateTcSupplyTask(SupplyTask entity) {
        log.info("正在处理砼材新增或修改供货任务,入参：{}", JSON.toJSONString(entity));
        SupplyTask localInfo = supplyTaskMapper.selectByTaskId(entity.getSupplyTaskId());
        if (localInfo != null) {
            entity.setId(localInfo.getId());
            supplyTaskMapper.updateByPrimaryKeySelective(entity);
        } else {
            supplyTaskMapper.insertSelective(entity);
        }
    }
}
